package org.jiuling.oss.minio.spring.config;

import org.jiuling.oss.minio.client.build.MinioClientBuilder;
import org.jiuling.oss.minio.client.factory.MinioFactory;
import org.jiuling.oss.minio.config.MinioConfig;
import org.jiuling.oss.minio.operation.MinioBucketOperation;
import org.jiuling.oss.minio.operation.MinioObjectOperation;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * MinioSpringBean配置
 * @author 紫灵
 * @date 2024年06月23日 08时30分43秒
 */
@Configuration
public class MinioSpringBeanConfig {

    @Bean
    @ConfigurationProperties(prefix = "jiu-ling.oss.minio")
    public MinioConfig minioConfig(){
        return new MinioConfig();
    }

    @Bean
    public MinioFactory minioFactory(){
        return new MinioClientBuilder(minioConfig());
    }

    @Bean
    public MinioBucketOperation minioBucketOperation(){
        return new MinioBucketOperation(minioFactory());
    }

    @Bean
    public MinioObjectOperation minioObjectOperation(){
        return new MinioObjectOperation(minioFactory());
    }


}
